import * as PdfJs from "pdfjs-dist";
import { FC, useEffect } from "react";

interface WorkerProps {
  workerUrl: string;
}

const Worker: FC<WorkerProps> = ({ children, workerUrl }) => {
  useEffect(() => {
    PdfJs.GlobalWorkerOptions.workerSrc = workerUrl;
  }, [workerUrl]);

  return <>{children}</>;
};

export default Worker;
